import { Injectable } from '@angular/core';
import { HttpClient } from '../../../providers/httpClient';
import { Config } from '../../../providers/config';
import { Storage } from '@ionic/storage';
import { Common } from '../../../providers/common';
import _ from 'lodash';

@Injectable()
export class MarketingMutualFundWeeklyService {
	constructor(
		public httpClient: HttpClient,
		public config: Config,
        public storage: Storage,
        public common: Common
	) { }
  
  /**
   * 获取移动经营分析数据
   * @param name 
   */
  getAnalyDataFromRedis(parmas) {
    let postBody: any = {
      module: "OAServer",
      method: "getAnalyDataFromRedis",
      params: {
        name: parmas.name,
        titleid: parmas.titleid
      }
    };

    return this.httpClient.post(postBody, {
      isShowLoading: true
    });
  }

  /**
   * 生成移动经营分析数据
   * @param name 
   */
  generateUSPAnalyData(name, titleid) {
    let postBody: any = {
      module: "OAServer",
      method: "generateUSPAnalyData",
      params: {
        name: name,
        titleid: titleid
      }
    };

    return this.httpClient.post(postBody, {
      isShowLoading: true
    });
  }

  /**
   * 发布移动经营分析数据
   */
  publishUSBMobileAnalyData(titleid) {
    let postBody: any = {
      module: "OAServer",
      method: "publishUSBMobileAnalyData",
      params: {
        titleid: titleid
      }
    };

    return this.httpClient.post(postBody, {
      isShowLoading: true
    });
  }

  /**
   * 回滚移动经营分析数据
   */
  rollBackUSBMobileAnalyData(titleid) {
    let postBody: any = {
      module: "OAServer",
      method: "rollBackUSBMobileAnalyData",
      params: {
        titleid: titleid
      }
    };

    return this.httpClient.post(postBody, {
      isShowLoading: true
    });
  }
}
